<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * create tax edit page
 * get: tax.edit.tpl.php
 *
 * @version    $Id$
 * @package    TobbiVM-Shop
 * @copyright  Copyright (C) 2012
 * @author     Norbert Gebert
 * @license    GPL3
 */
$_GET['id'] = $refValidate->cleanslash($_GET['id']);
db::getInstance()->where('tax_id', $_GET['id']);
$result = db::getInstance()->getOne('tax');

if (db::getInstance()->count <= 0)
{
	message::setErrorRow(_('Databaseerror! - Contact Admin!'), TRUE);
}
else
{
	$refPage->assign('page_title', _('Edit Tax'));

	$refPage->assign('id', _('Tax-ID') . '= ' . $result['tax_id']);

	$refPage->assign('name', _('Tax-Name'));
	$refPage->assign('namex', $result['tax_name']);
	$refPage->assign('namexHelp', help('taxname', $page));
	
	$refPage->assign('value', _('Tax-Value in Percent'));
	$refPage->assign('valuex', str_replace('.', ',', $result['tax_value']));
	$refPage->assign('valuexHelp', help('taxvalue', $page));
	
	$refPage->assign('Form_Start',
		'<form class="niceform fieldset" action="' .
		'index2.php?page=' . $page . '&sub=' . $subpage .
		'" method="post"><fieldset>');
	$refPage->assign('Form_End',
		'<input type="hidden" name="idx" value="' . $result['tax_id'] . '">' .
		'</fieldset></form>');

	$refPage->assign('btn_save',
		'<input type="submit" name="submit" id="save" value="' .
		_('Save') . '" />');
	$refPage->assign('btn_abort',
		'<input type="submit" name="submit" id="abort" value="' .
		_('Cancel') . '" />');

	$refPage->addtpl('content', '/' . $page . '/' . $subpage . '.editor.tpl.php');
}
?>
